﻿using ModernShopping.AppCode;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ModernShopping
{
    public partial class StoreInMap : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                List<Store> stores = new List<Store>();
                if (Request.QueryString["SelectedStore"] != null)
                {
                    int ID = int.Parse(Request.QueryString["SelectedStore"]);
                    stores.Add(DbStore.GetByID(ID));
                }
                if (stores.Count > 0)
                {
                    string displayMarkers = "setMarkerFromDatabase('{0}');";
                    displayMarkers = string.Format(displayMarkers, Marker.ParseListJson(stores));
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "Create", displayMarkers, true);
                }
            }
        }
    }
}